﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using System.IO;

namespace Aspfm.Factory.Main
{
    public class Start
    {
        public static void start(string[] args)
        {
            if (!(args != null && args.Length == 3 && File.Exists(args[0] + args[1])))
            {
                CheckUpdate();
            }
            //Aspfm.Control.Common.Start.start(args);
        }

        public static void CheckUpdate()
        {
            string zippath = Directory.GetParent(AppDomain.CurrentDomain.BaseDirectory.TrimEnd('\\')).FullName;
            String path = zippath + "MAutoUpdate.exe";
            //同时启动自动更新程序
            if (System.IO.File.Exists(path))
            {
                ProcessStartInfo processStartInfo = new ProcessStartInfo()
                {
                    FileName = "MAutoUpdate.exe",
                    Arguments = " Aspfm.Design 0"
                };
                //processStartInfo.WorkingDirectory = AppDomain.CurrentDomain.BaseDirectory;
                //processStartInfo.UseShellExecute = false;
                //processStartInfo.CreateNoWindow = true;
                Process proc = Process.Start(processStartInfo);
                if (proc != null)
                {
                    proc.WaitForExit();
                }
            }
        }
    }
}
